package com.example.beangenerate.dao;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class MybatisDaoImpl implements MybatisDao {
	private SqlSessionTemplate sqlSessionTemplate;

	public MybatisDaoImpl(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public <T> List<T> selectList(T var) {
		return this.sqlSessionTemplate.selectList(var.getClass().getName().concat(".selectList"),var);
	}

	@Override
	public <T> T selectOne(T var) {
		return this.sqlSessionTemplate.selectOne(var.getClass().getName().concat(".selectOne"),var);
	}

	@Override
	public <T> List<T> selectList(String className, T var) {
		return this.sqlSessionTemplate.selectList(className,var);
	}

}
